<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sistema de Classificados Online</title>
</head>
<body>
	<div align="center">
		<h2>Sistema de Classificados Online</h2>
	</div>
	<hr />
	<f:view>
		<h:outputText id="o2" value="#{usuarioMB.mensagem}"
			rendered="#{usuarioMB.temMensagem}" style="color: #0000FF"></h:outputText>
		<h:outputText id="o6" value="#{sessaoMB.mensagem}"
			rendered="#{sessaoMB.temMensagem}" style="color: #008040"></h:outputText>
		<div align="right">
			<h:form id="f1">
				<h:outputText id="o3"
					value="Usuário logado: #{sessaoMB.usuario.nome}"
					rendered="#{sessaoMB.logado}"></h:outputText>
				<h:commandLink id="c1" value="Efetue Login" action="login.jsp"
					rendered="#{sessaoMB.notLogado}"></h:commandLink> |
			<h:commandLink id="c2" value="Logout" action="#{sessaoMB.logout}"
					rendered="#{sessaoMB.logado}"></h:commandLink>
				<h:commandLink id="c3" value="Faça o seu cadastro"
					action="cadastroUsuario.jsp" rendered="#{sessaoMB.notLogado}"></h:commandLink>
			</h:form>
		</div>

		<hr />
		<div align="center">
			<h3>Lista dos Anuncios</h3>
			<h:dataTable id="d1" border="1"
				rendered="#{classificadosMB.comAnuncios}"
				value="#{classificadosMB.anuncios}" var="anuncio">
				<h:column id="c5">
					<f:facet name="header">
						<h:outputText value="Descrição" />
					</f:facet>
					<h:outputText id="o4" value="#{anuncio.descricao}"></h:outputText>
				</h:column>
				<h:column id="c6">
					<f:facet name="header">
						<h:outputText value="Responsável"></h:outputText>
					</f:facet>
					<h:outputText id="o5" value="#{anuncio.usuario.nome}"></h:outputText>
				</h:column>
				<h:column id="c7">
					<f:facet name="header">
						<h:outputText value="Preço (R$)"></h:outputText>
					</f:facet>
					<h:outputText id="o6" value="#{anuncio.valor}"></h:outputText>
				</h:column>
			</h:dataTable>
			<h:outputText id="o1"
				value="Ainda não foi cadastrado nenhum anuncio... "
				rendered="#{classificadosMB.semAnuncios}"></h:outputText>
		</div>
		<h:form id="f2">
			<h:commandButton id="c4" value="Cadastrar novo Anuncio"
				rendered="#{sessaoMB.logado}" action="cadastroAnuncio.jsp"></h:commandButton>
		</h:form>
	</f:view>
	<hr />
</body>
</html>